<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8" />
  <title>index</title>
  <!-- 引入Vue -->
  <script type="text/javascript" src="../../js/vue.js"></script>
</head>

<body>
  <!-- 准备好一个容器-->
  <div id="demo"></div>
</body>

<script type="text/javascript">
  let School = Vue.extend({
    data() {
      return {
        school: '北京邮电大学',
        address: '北京'
      }
    },
    methods: {
      showSchool() {
        alert(`${this.school},做落于${this.address}`)
      }
    },
    // 创建模板
    template: `
      <div>
        <h2>学校的信息</h2>
        <h3>名称:{{school}}</h3>
        <h3>地址:{{address}}</h3>
        <input type="submit" @click="showSchool">
      </div>
    `
  })
  // 创建Vue实例
  new Vue({
    el: '#demo',
    // 使用
    components: { School },
    // 创建模板
    template: `
      <div>
        <School/>
      </div>
    `

  })
</script>

</html>